#include "bits/stdc++.h"
using namespace std;
using ll = long long;
const int N = 10009; //100005

int n,cnt;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	int T;
	cin>>T;
	while(T--)
	{
		cnt=0;
		cin>>n;
		for(int i=1;i<=n;i++)
		{
			int x;
			cin>>x;
			if(x==1) cnt++;
		}
		cout<<cnt<<endl;
		if(cnt == 0)
			for(int i=1;i<=n;i++)
				cout<<"0 ";
		else
			for(int i=1;i<=n;i++)
				cout<<"1 ";
		cout << endl;
	}
	return 0;
}
